﻿/**********************************************************************
 * @file   GUISpectrogramResultDialog.h
 * @brief  后处理云图结果设置界面声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-03-05
 *********************************************************************/
#ifndef _GUISpectrogramResultDialog_H_
#define _GUISpectrogramResultDialog_H_

#include "GUIPostDialogAPI.h"
#include "GUIWidget/GUIDialogBase.h"

namespace Ui {
class GUISpectrogramResultDialog;
}

namespace Acoustics {
    class FITKAcousticsContourPlotData;
    class FITKAcousticsHDF5DataSetManager;
    class FITKAcousticsHDF5ObjectManager;
}

namespace Core {
    class FITKActionOperator;
}

namespace GUI
{
    /**
     * @brief   后处理云图结果设置界面
     * @author  liuzhonghua (liuzhonghuaszch@163.com)
     * @date    2025-03-05 
     */
    class GUIPostDialogAPI GUISpectrogramResultDialog : public GUIDialogBase
    {
        Q_OBJECT

    public:
        /**
         * @brief   Construct a new GUISpectrogramResultDialog object
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        explicit GUISpectrogramResultDialog(Acoustics::FITKAcousticsContourPlotData* plotData, Core::FITKActionOperator* oper, QWidget *parent = nullptr);

        /**
         * @brief   Destroy the GUISpectrogramResultDialog object
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        ~GUISpectrogramResultDialog();

    protected slots:
        /**
         * @brief   按钮应用点击槽
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        void on_pushButton_Apply_clicked();
        /**
         * @brief   按钮确定点击槽
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        void on_pushButton_OK_clicked();
        /**
         * @brief   按钮关闭点击槽
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        void on_pushButton_Close_clicked();
        /**
         * @brief    on checkBox Display clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Display_clicked(bool checked);
        /**
         * @brief    on radioButton At clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_radioButton_At_clicked(bool checked);
        /**
         * @brief    on radioButton OverAllLevel clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_radioButton_OverAllLevel_clicked(bool checked);
        /**
         * @brief    on comboBox Hz currentIndexChanged slot
         * @param[i] index 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_comboBox_Hz_currentIndexChanged(int index);
        /**
         * @brief    on comboBox REsultType currentIndexChanged slot
         * @param[i] index 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_comboBox_REsultType_currentIndexChanged(int index);
        /**
         * @brief    on comboBox EngUnitsType currentIndexChanged slot
         * @param[i] index 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_comboBox_EngUnitsType_currentIndexChanged(int index);
        /**
         * @brief    on checkBox Pressure DB clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Pressure_DB_clicked(bool checked);
        /**
         * @brief    on checkBox Velocity DB clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Velocity_DB_clicked(bool checked);
        /**
         * @brief    on checkBox Pressure A clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Pressure_A_clicked(bool checked);
        /**
         * @brief    on checkBox Velocity A clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Velocity_A_clicked(bool checked);
        /**
         * @brief    on checkBox Pressure Auto clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Pressure_Auto_clicked(bool checked);
        /**
         * @brief    on checkBox Velocity Auto clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_Velocity_Auto_clicked(bool checked);
        /**
         * @brief    on checkBox Velocity Ref clicked slot
         * @param[i] text 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_lineEdit_Velocity_Ref_textChanged(QString& text);
        /**
         * @brief    on checkBox Pressure Ref clicked slot
         * @param[i] text 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_lineEdit_Pressure_Ref_textChanged(QString& text);
        /**
         * @brief    on radioButton Continuous clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_radioButton_Continuous_clicked(bool checked);
        /**
         * @brief    on radioButton UserDiscrete clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_radioButton_UserDiscrete_clicked(bool checked);
        /**
         * @brief    on pushButton MaxColor clicked slot
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_pushButton_MaxColor_clicked();
        /**
         * @brief    on pushButton MinColor clicked slot
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_pushButton_MinColor_clicked();
        /**
         * @brief    on checkBox LineShow clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_checkBox_LineShow_clicked(bool checked);
        /**
         * @brief    on pushButton LineColor clicked slot
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        void on_pushButton_LineColor_clicked();

    protected:
        /**
         * @brief   初始化界面数据
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05
         */
        void init();
        /**
         * @brief  初始化窗口
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-03-05
         */
        void initWidget();
        /**
         * @brief    初始化频率下拉框
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void initFreqComboBox();
        /**
         * @brief    初始化载荷工况下拉框
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void initLoadCaseComboBox();
        /**
         * @brief    初始化结果类型下拉框
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void initResultTypeComboBox();
        /**
         * @brief    初始化工程数据
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void initEngineeringUnits();
        /**
         * @brief    设置窗口标题
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void updateWidgetTitle();
        /**
         * @brief    更新压力的单位
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void updatePressureUnit();
        /**
         * @brief    更新速度的单位
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void updateVelocityUnit();
        /**
         * @brief    获取子系统结果管理器
         * @param[i] loadCaseName 
         * @return   Acoustics::FITKAcousticsHDF5ObjectManager *
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        Acoustics::FITKAcousticsHDF5ObjectManager* getSubsystemResultManager(QString loadCaseName);
        /**
         * @brief    计算dB和A权
         * @param[i] value 被计算的值
         * @param[i] freqValue 频率
         * @param[i] isAWei 是否计算A权
         * @param[i] isDB 是否计算DB
         * @param[i] dbUserValue dB的数值
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        double calcParaData(double value, double freqValue, bool isAWei, bool isDB, double dbUserValue);
        /**
         * @brief    计算OverAll
         * @param[i] value 被计算的值
         * @param[i] isDB 是否计算DB
         * @param[i] isAll 
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        double calcOverAllParaData(double value, bool isDB, bool isAll);
        /**
         * @brief    更新最大值和最小值
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void updateMaxMinData();
        /**
         * @brief    更新工程数据
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void updateEngUnitData();
        /**
         * @brief    获取工程数据云图名称
         * @return   QString
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-06
         */
        QString getEngUnitPlotName();
        /**
         * @brief    获取工程数据
         * @return   QHash<int, float> 子系统名称, 数据
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        QHash<QString, float> getEngUnitData();
        /**
         * @brief    保存数据
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        void saveData();
        /**
         * @brief    通过频谱获取A权
         * @param[i] freq 
         * @return   double
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-03-05
         */
        double getAWeightingValue(double freq);

    private:
        /**
         * @brief   ui
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        Ui::GUISpectrogramResultDialog *_ui;
        /**
         * @brief  操作器对象
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-03-05 
         */
        Core::FITKActionOperator* _oper = nullptr;
        /**
         * @brief   数据对象
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date    2025-03-05 
         */
        Acoustics::FITKAcousticsContourPlotData* _plotData = nullptr;


    };
}
#endif // GUISpectrogramResultDialog_H
